package com.cn.designpatterns.ex.concrete.mediator.demo2;

/**
 * @author: zhangyi
 * @date: 2019/1/11 09:45
 * @description:
 */
public class CountryMediator extends Mechanism{
    private Usa usa;
    private China china;

    public void setUsa(Usa usa) {
        this.usa = usa;
    }

    public void setChina(China china) {
        this.china = china;
    }

    @Override
    public void declare(String message, Country country) {
        if(country instanceof Usa){
            usa.getMessage(message);
        }else if(country instanceof China){
            china.getMessage(message);
        }
    }
}
